layui.use(['table', 'jquery'], function (data) {
    var table = layui.table,
        $ = layui.jquery;


    // 搜索
    $(".search_btn").click(function () {
        tableIns.reload({
            where: {
                materialName: $("[name='materialName']").val(),
                materialNo: $("[name='materialNo']").val()
            }, page: {
                curr: 1
            }
        })
    })

    var tableIns = table.render({
        elem: "#warehouse",
        height: 'full-125',
        url: ctx + '/warehouse/selectByParamsList',
        page: true,
        cellMinWidth: 80, // 单元格最小宽度
        toolbar: '#toolbarDemo',
        cols: [[// 表头
            {type: 'checkbox'},
            {type: "numbers"},
            {title: "物料编码", field: "materialNo"},
            {
                title: "物料名称", templet: function (data) {
                    return data.materialBean.materialName;
                }
            },
            {title: "物料库存", field: "materialCount"},
            {
                title: "物料单位", templet: function (data) {
                    return data.materialBean.materialUnit
                }
            },
            {
                title: "属性", field: "type", templet: function (data) {
                    if (data.type == 0) {
                        return "原材料"
                    }
                }
            }

        ]]
    })


})